package oldCar;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2022-11-07
 * Time: 14:41
 */
public class oldCarExample {
    static class Car {
        public void init () {
            //依赖车身
            Framework framework = new Framework();
            framework.init();
            System.out.println("车子启动");
        }
    }

    /**
     * 车身类
     */
    static class Framework {
        public void init() {
            //依赖底盘
            Bottom bottom = new Bottom();
            bottom.init();
            System.out.println("车身类启动");
        }
    }

    /**
     * 底盘类
     */
    static class Bottom {
        public void init() {
            //依赖轮胎
            Tire tire = new Tire();
            tire.init();
            System.out.println("底盘类启动");
        }
    }

    /**
     * 轮胎类
     */
    static class Tire {
        private int size =15;//轮胎尺寸
        public void init() {
            System.out.println("轮胎尺寸"+size);
        }
    }

    public static void main(String[] args) {
        Car car = new Car();
        car.init();
    }
}
